const exec = require("../db/mysql")
const queryUsername = (req,res,next) => {
  const username = req.body.username
  const sql = `select * from user where username="${username}"`
  exec(sql).then(result=> {
    if(result.length>0){
      res.json({msg:"用户已存在"})
    }else {
      next()
    }
  })
}
module.exports = queryUsername